#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int minTimeToVisitAllPoints(vector<vector<int>>& points) {
    int ret = 0;
    int len = points.size();
    if(len<=1) {
        ret = 0;
    } else {
        int stepx=0;
        int stepy=0;
        for(int i=1; i<len; ++i) {
            stepx = abs(points[i][0] - points[i-1][0]);
            stepy = abs(points[i][1] - points[i-1][1]);
            stepx>stepy ? ret+=stepx : ret+=stepy;
        }
    }
   return ret; 
}

int main() {
    int ret = 0;
    vector<vector<int>> points = {{1,1},{3,4},{-1,0}};
    ret = minTimeToVisitAllPoints(points);
    cout << ret << endl;


    return ret;
}

